package test;

import javax.swing.*;
import java.awt.*;

public class Swi extends JFrame {

	MyPanel mp=null;
	public static void main(String[] args) {
		// TODO 自动生成的方法存根
		Swi s=new Swi(); 
	}
	
	public Swi(){
		mp=new MyPanel();
		this.add(mp);
		
		this.setSize(300,400);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	} 

}


//定义一个MyPanel
class MyPanel extends JPanel{
	
	public void paint(Graphics g){
		super.paint(g);
		g.drawOval(10, 10, 30, 30 );
	}
	 
}
